package com.morgan.recyclerviewdemo.activity

import android.graphics.BitmapFactory
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.morgan.recyclerviewdemo.R
import com.morgan.recyclerviewdemo.entity.WeatherLineData
import com.morgan.recyclerviewdemo.view.WeatherLineView
import kotlin.random.Random

/**
 *description：
 *<br>author：caowugao
 *<br>time：2020/8/2 0002 16:23
 */
class WeatherLineActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.act_weather_line)
        val weatherLineView = findViewById<WeatherLineView<WeatherLineData>>(R.id.weatherLineView)

        val list = mutableListOf<WeatherLineData>()
        list.add(WeatherLineData(13, 31))
        list.add(WeatherLineData( 14, 31))
        list.add(WeatherLineData( 15, 29))
        list.add(WeatherLineData( 16, 28))
        list.add(WeatherLineData( 17, 27))
        list.add(WeatherLineData( 18, 26))
        list.add(WeatherLineData( 19, 25))
        list.add(WeatherLineData( 20, 19))

        val icon = BitmapFactory.decodeResource(resources, R.mipmap.ic_launcher)
        val rang = 0..list.size - 1
        for (i in rang) {
            weatherLineView.mCoorinateXIcons.add(icon)
        }
        weatherLineView.mContentBackground = BitmapFactory.decodeResource(resources, R.drawable.bg)
        weatherLineView.setUp(list)
    }

}